package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

public class oosDemo {
    public static void main(String[] args) throws IOException {
        String name="刘桑";
        int age=55;
        String gender="男";
        String[]otherInfo={"技术好","技术超好","拍片技术好","大家的启蒙老师"};
        Person p=new Person(name,age,gender,otherInfo);
        System.out.println(p);
        //将person对象写入文件person.obj中
        FileOutputStream fos=new FileOutputStream("person.obj");
        ObjectOutputStream oos=new ObjectOutputStream(fos);
        oos.writeObject(p);
        System.out.println("执行完毕!");
        oos.close();
    }
}
